<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.org/ui">
    <head>
        <title>TODO supply a title</title>
    </head>
    <h:body> 
        <ui:composition  template="/resources/template/myTemplate.xhtml">
            <ui:define name="content">
                <c:set var="registered" scope="view" value="#{userManagedBean.registered}"/>
                <c:if test="${registered}">   
                    <h:form>
                        <h3>Search query</h3>
                        <h:panelGrid columns="2">
                            <h:outputLabel value="Amount : "/>
                            <h:inputText value="#{queriesManagedBean.serchQuery.amount}" required="false"/>

                            <h:outputLabel value="Currency from : "/>
                            <h:selectOneMenu value="#{queriesManagedBean.serchQuery.currencyFrom}" >
                                <f:selectItems value="#{queriesManagedBean.currencyMB.currencyList}" var="cur"
                                               itemLabel="#{cur.shortName}" itemValue="#{cur.shortName}" />
                                <f:converter converterId="com.bionic.ce.CurrencyConverter"/>
                            </h:selectOneMenu>

                            <h:outputLabel value="Currency to : "/>
                            <h:selectOneMenu value="#{queriesManagedBean.serchQuery.currencyTo}" >
                                <f:selectItems value="#{queriesManagedBean.currencyMB.currencyList}" var="cur"
                                               itemLabel="#{cur.shortName}" itemValue="#{cur.shortName}" />
                                <f:converter converterId="com.bionic.ce.CurrencyConverter"/>
                            </h:selectOneMenu>

                            <h:outputLabel value="Rate from : "/>
                            <h:inputText value="#{queriesManagedBean.serchQuery.rateFrom}" required="false"/>

                            <h:outputLabel value="Rate to : "/>
                            <h:inputText value="#{queriesManagedBean.serchQuery.rateTo}" required="false" />	       

                            <p:commandButton value="Search" action="#{queriesManagedBean.doShowSearchResults()}"/>
                        </h:panelGrid>
                    </h:form>
                </c:if>
                <c:if test="${!registered}">
                    Dear costumer you don`t have acces to this part of service. Please log-in or register.
                </c:if>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
